<?php

class ui_tinymce extends ui
{

    protected $name = ''; // 名称
    protected $value = ''; // 默认值
    protected $width = '100%'; // 宽度
    protected $height = '200px'; // 高度


    public function init()
    {
        $this->name = '';
        $this->value = '';
        $this->width = '100%';
        $this->height = '200px';
    }
    
    public function set_name($name)
    {
        $this->name = $name;
    }
    
    public function set_value($value)
    {
        $this->value = $value;
    }
    
    public function set_width($width)
    {
        $this->width = $width;
    }
    
    public function set_height($height)
    {
        $this->height = $height;
    }
    
    public function set_size($width, $height)
    {
        $this->width = $width;
        $this->height = $height;
    }

    public function display()
    {
        if(!defined('tinymce_loaded'))
        {
            define('tinymce_loaded', 1);
            ?>
<script type="text/javascript" src="<?php echo BONE_URL; ?>/uis/tinymce/jquery.tinymce.js"></script>
<script type="text/javascript">
	$().ready(function() {
		$('textarea.tinymce').tinymce({
			script_url : '<?php echo BONE_URL; ?>/uis/tinymce/tiny_mce.js',
			language : "zh",
			theme : "advanced",
			
			force_p_newlines : false, 
			force_br_newlines : true, 
			remove_linebreaks : false,
			button_tile_map : true,

			theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,|,bullist,numlist,|,forecolor,backcolor,fontselect,fontsizeselect,|,removeformat",
			theme_advanced_buttons2 : "",
			theme_advanced_buttons3 : "",
			theme_advanced_buttons4 : "",
			theme_advanced_toolbar_location : "top",
			theme_advanced_toolbar_align : "left",
			theme_advanced_statusbar_location : "none",
			theme_advanced_fonts : "黑体=黑体;楷体=楷体;仿宋=仿宋;隶书=隶书;幼圆=幼圆;Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats",

			font_size_style_values : "8px,10px,12px,14px,18px,24px,36px"
		});
	});
</script>
        <?php
        }
        
        echo '<textarea name="' . $this->name . '" id="' . $this->name . '" class="tinymce" style="width:' . $this->width . ';height:' . $this->height . ';">' . htmlspecialchars($this->value) . '</textarea>';
    }



}
?>